﻿@model IndoReputation.Models.BusinessObject.Collections.RankTypeList

@{
    ViewBag.Title = "List Rank Type";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>List Rank Type</h2>
<div class="grid-main">
    @(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(keys =>
        {
            keys.Add(p => p.ID);
        })
        .ToolBar(toolbar => toolbar.Template(@<text>@item.CustomCommandToolBarButton("insertnew", "Add new Rank Type", "Add", "RankType", null, false, GridButtonType.Text)</text>))
        .Columns(columns =>
        {
            columns.Bound(o => o.No).Width(50);            
            columns.Bound(o => o.Name).Width(150);
            columns.Bound(o => o.RankValue).Width(100);
            columns.Bound(o => o.CreateAt).Format("{0:dd/MM/yyyy}").Width(80);
            columns.Command(commands =>
            {
                commands.Custom("viewDetail")
                    .Text("Edit")
                    .DataRouteValues(route => route.Add(o => o.ID).RouteKey("rankTypeID"))
                    .Ajax(false)
                    .Action("Edit", "RankType")
                    .HtmlAttributes(new { style = "text-align: center" });
                commands.Delete();
            })
                .Width(200).HtmlAttributes(new { style = "text-align: center" });

        })
                                                .DataBinding(dataBinding =>
                                                {
                                                    dataBinding.Server().Select("Index", "RankType", new { ajax = ViewData["ajax"] });
                                                    dataBinding.Ajax().Select("_Index", "RankType").Enabled((bool)ViewData["ajax"])
                                                        .Delete("_DeleteAjaxEditing", "RankType");
                                                })
                                                .Selectable()
                                                .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
                                                .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
                                                .Pageable(paging => paging.PageSize(20).Enabled((bool)ViewData["paging"]))
                                                .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
                                                .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
                                                .Footer((bool)ViewData["showFooter"])
                                                .ClientEvents(events => events.OnComplete("Assessments_onComplete"))                                                                                                                    
                                        )
</div>
<script src="@Url.Content("~/Scripts/indo.common.js")" type="text/javascript"></script>